package com.ithanwen.controller;

import com.aliyuncs.exceptions.ClientException;
import com.ithanwen.pojo.Result;
import com.ithanwen.utils.OSSUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created By tony
 * <br/>Date: 2025/7/11 14:47
 * <br/>Description:
 */
@RestController
public class UploadController {
    @Autowired
    private OSSUtils ossUtils;
    @PostMapping("/upload")
    public Result upload(MultipartFile file) throws ClientException {
        String uploadFile = file.getOriginalFilename();
        return Result.success(ossUtils.uploadFile(file, uploadFile));
    }
}
